package Exercise03;

import java.math.BigDecimal;

public class Person {
    public static void main(String[] args) {


        Test res1 = new Test("李四", "女", 21, "79.5");
        Test res2 = new Test("张三", "男", 20, "80.2");
        Test res3 = new Test("王五", "男", 22, "77.9");
        Test res4 = new Test("周六", "男", 20, "55.8");
        Test res5 = new Test("赵七", "女", 21, "99.9");


       /*String num =  res1.science+res2.science+res3.science+res4.science+res5.science;
        System.out.println(num);*/

        BigDecimal a = new BigDecimal(String.valueOf(res1.getScience()));
        BigDecimal b = new BigDecimal(String.valueOf(res2.getScience()));
        BigDecimal c = new BigDecimal(String.valueOf(res3.getScience()));
        BigDecimal d = new BigDecimal(String.valueOf(res4.getScience()));
        BigDecimal e = new BigDecimal(String.valueOf(res5.getScience()));
        BigDecimal num = a.add(b).add(c).add(d).add(e);
        BigDecimal bigDecimal = new BigDecimal(5);
        BigDecimal decimal = num.divide(bigDecimal);
        BigDecimal res = num.divide(bigDecimal, 2, BigDecimal.ROUND_HALF_UP);
             System.out.println(res);
    }


}
